package br.com.firula.web;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.ServletActionContext;
import org.springframework.beans.factory.annotation.Autowired;

import br.com.firula.bo.NoticiaBO;
import br.com.firula.to.NoticiaTO;
import br.com.firula.to.BaseTO;
import br.com.firula.web.filter.Filtro;

public class NoticiaAction  extends GenericAction{

	private static final long serialVersionUID = -11105595311416759L;

	HttpServletResponse response;
	HttpServletRequest request;

	private NoticiaBO mgrNoticia;

	@Autowired
    public void setNoticiaBO(NoticiaBO NoticiaBO) {
        this.mgrNoticia = NoticiaBO;
    }

	public String list(){
		this.request = ServletActionContext.getRequest();
		this.response = ServletActionContext.getResponse();

		NoticiaTO noticia = new NoticiaTO();
		Filtro noticiaFiltro = new Filtro();
		noticiaFiltro.setClazz(NoticiaTO.class);
		noticiaFiltro.setExample(noticia);
		request.setAttribute("noticiaList", mgrNoticia.getList(noticiaFiltro));
		return "listAdm";
	}

	@Override
	protected BaseTO getNew() {
		return null;
	}

}
